package net.lzzy.repository;

import net.lzzy.entity.Article;
import net.lzzy.entity.Comment;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;

import javax.transaction.Transactional;
import java.util.List;

public interface CommentRepository extends JpaRepository<Comment, Integer> {

    public List<Comment> findByArticleId(Integer id);

    @Transactional
    @Modifying
    public void deleteByArticle(Article article);
}
